import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import UserCenter from '@/views/UserCenter.vue'
import UserInfo from '@/components/userInfo.vue'
import GameUpload from '@/components/gameUpload.vue'
import GameDetail from '@/views/GameDetail.vue'
import Searched from '@/views/Searched.vue'
import GameManage from '@/components/gameManage.vue'


const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path: '/usercenter',
      name: 'userCenter',
      component : UserCenter,
      children : [
        {
          path: '',
          name: 'userInfo',
          component : UserInfo,
        },
        {
          path: 'gameUpload',
          name: 'gameUpload',
          component : GameUpload,
        },
        {
          path: 'gameManage',
          name: 'gameManage',
          component : GameManage,
        }
      ]
    },
      {
        path: '/gamedetail/:gid',
        name: 'gameDetail',
        component: GameDetail
      },
      {
        path: '/search',
        name: 'searchPage',
        component: Searched
      }
  ]
})

export default router
